package com.gxa.sideParking.admin.service.impl;

import com.gxa.sideParking.admin.pojo.Manager;
import com.gxa.sideParking.admin.mapper.ManagerMapper;
import com.gxa.sideParking.admin.service.ManagerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxa.sideParking.core.common.JsonResult;
import com.gxa.sideParking.core.common.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author gxa
 * @since 2022-10-05
 */
@Service
public class ManagerServiceImpl extends ServiceImpl<ManagerMapper, Manager> implements ManagerService {

    @Autowired
    private ManagerMapper managerMapper;

    @Override
    public JsonResult findAll(Integer currentPage, Integer pageSize) {
        Integer start = (currentPage-1)*pageSize;
        Integer off = pageSize;
        List<Manager> findAllList = managerMapper.findAll(start,off);
        return ResponseUtil.success("查询成功",findAllList);
    }

    @Override
    public List<Manager> findTime(String managerDate) {
//        Date date = new Date();
//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
//        String dateTime = format.format(date);
//        Manager manager = new Manager();
//        manager.setManagerDate(dateTime);
//        manager.getManagerDate();
        List<Manager> findTimeList = managerMapper.findTime(managerDate);
//        return ResponseUtil.success("查询成功",findTimeList);
        return findTimeList;
    }

    //出账总金额查询
    @Override
    public List<Manager> findOutMoney() {
        List<Manager> outMoney = managerMapper.findOutMoney();
//        return ResponseUtil.success("查询成功",outMoney);
//        Manager manager = new Manager();
//        manager.getManagerMoney();
//        return manager;
        return outMoney;
    }

    @Override
    public List<Manager> findPutMoney() {
        List<Manager> putMoney = managerMapper.findPutMoney();
//        return ResponseUtil.success("查询成功",putMoney);
        return putMoney;
    }

    @Override
    public List<Manager> findWeek() {
        List<Manager> week = managerMapper.findWeek();
        return week;
    }

    @Override
    public List<Manager> findMonth() {
        List<Manager> month = managerMapper.findMonth();
        return month;
    }

    @Override
    public List<Manager> findLastMonth() {
        List<Manager> lastMonth = managerMapper.findLastMonth();
        return lastMonth;
    }
}
